import 'osc_notice.dart';

class OscCommentListEntity {
	List<OscComment> commentList;
	OscNotice notice;

	OscCommentListEntity({this.commentList, this.notice});

	OscCommentListEntity.fromJson(Map<String, dynamic> json) {
		if (json['commentList'] != null) {
			commentList = new List<OscComment>();(json['commentList'] as List).forEach((v) { commentList.add(new OscComment.fromJson(v)); });
		}
		notice = json['notice'] != null ? new OscNotice.fromJson(json['notice']) : null;
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		if (this.commentList != null) {
      data['commentList'] =  this.commentList.map((v) => v.toJson()).toList();
    }
		if (this.notice != null) {
      data['notice'] = this.notice.toJson();
    }
		return data;
	}
}

class OscComment {
	List<OscCommentReply> replies;//帖子中评论
	List<OscCommentRefer> refers;//评论中引用
	String commentPortrait;//评论人头像
	int commentAuthorId;//评论人ID
	String commentAuthor;//评论人
	int id;//评论ID
	int clientType;//1-WEB、2-WAP、3-Android、4-IOS、5-WP
	String pubDate;//发布日期
	String content;//评论内容

	OscComment({this.replies, this.refers, this.commentPortrait, this.commentAuthorId, this.commentAuthor, this.id, this.clientType, this.pubDate, this.content});

	OscComment.fromJson(Map<String, dynamic> json) {
		if (json['replies'] != null) {
			replies = new List<OscCommentReply>();(json['replies'] as List).forEach((v) { replies.add(new OscCommentReply.fromJson(v)); });
		}
		if (json['refers'] != null) {
			refers = new List<OscCommentRefer>();(json['refers'] as List).forEach((v) { refers.add(new OscCommentRefer.fromJson(v)); });
		}
		commentPortrait = json['commentPortrait'];
		commentAuthorId = json['commentAuthorId'];
		commentAuthor = json['commentAuthor'];
		id = json['id'];
		clientType = json['client_type'];
		pubDate = json['pubDate'];
		content = json['content'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		if (this.replies != null) {
      data['replies'] =  this.replies.map((v) => v.toJson()).toList();
    }
		if (this.refers != null) {
      data['refers'] =  this.refers.map((v) => v.toJson()).toList();
    }
		data['commentPortrait'] = this.commentPortrait;
		data['commentAuthorId'] = this.commentAuthorId;
		data['commentAuthor'] = this.commentAuthor;
		data['id'] = this.id;
		data['client_type'] = this.clientType;
		data['pubDate'] = this.pubDate;
		data['content'] = this.content;
		return data;
	}
}

class OscCommentReply {
	String rPubDate;//帖子中评论 评论 的时间
	String rContent;//帖子中评论 评论 的内容
	int rAuthorId;//帖子中评论 评论 的人的ID
	String rAuthor;//帖子中评论 评论 的人

	OscCommentReply({this.rPubDate, this.rContent, this.rAuthorId, this.rAuthor});

	OscCommentReply.fromJson(Map<String, dynamic> json) {
		rPubDate = json['rpubDate'];
		rContent = json['rcontent'];
		rAuthorId = json['rauthorId'];
		rAuthor = json['rauthor'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['rpubDate'] = this.rPubDate;
		data['rcontent'] = this.rContent;
		data['rauthorId'] = this.rAuthorId;
		data['rauthor'] = this.rAuthor;
		return data;
	}
}

class OscCommentRefer {
	String referTitle;//评论中引用的标题
	String referBody;//评论中引用的内容

	OscCommentRefer({this.referTitle, this.referBody});

	OscCommentRefer.fromJson(Map<String, dynamic> json) {
		referTitle = json['refertitle'];
		referBody = json['referbody'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['refertitle'] = this.referTitle;
		data['referbody'] = this.referBody;
		return data;
	}
}
